CentOS 7 Install with UEFI Boot and Software RAID1
The purpose of this document is to chronicle the setup of a RAID1 boot within CentOS 7. In trying to set this up, I've encountered several pitfalls and complexities. I hope to address those here and provide an end-to-end guide for myself and others wishing to do similar activities. = System Description = * Hardware: Dell Poweredge R515 ** UEFI Firmware ** 1 Dell-packaged SATA Drive ** 1 Self-provided SATA Drive * Operating System: CentOS 7 (1503) - released 03/31/2015 ** GRUB2 ** mdRAID (Linux Native Software RAID) ** LVM As it seems, the Dell server is incapable of utilizing an alternate boot path in "BIOS" boot mode. I had to go with UEFI boot mode. As it turns out, UEFI seems to be more "extensible" anyways so this worked out well. Unfortunately, the CentOS 7 Installation DVD I'm using doesn't do RAID1 setups very well for /boot. Because of this, there are some manual steps that I needed to execute to have a complete working installation and end-result. In an attempt to cut costs, I ordered the server without a RAID card and only a single drive as I have SATA drives here I could use. In retrospect, it probably cost me more in time and effort of getting the additional drive carriers and screws for allowing the drives to fit into the hot-swap bays. I would advise if you go this route, to just spend the extra money on the drives. But if you're interested in proceeding down this path, here's a google search of the part number for the drive carriers (I bought mine direct from Dell as a spare part) and here's where I bought the screws to mount the carriers to the drives. I had other drives I'm using in the server, so I bought enough carriers to utilize them. One interesting item to note is that I couldn't order the server without a drive. The drive that came packaged with the R515, and I assume all Dell servers for that matter, had a diagnostic partition loaded on it. Because I'm not 100% sure if I'll ever want or need these diagnostic utilities, I decided to keep them and also mirror them onto the alternate drive of my RAID1 setup. If you're following this guide and you do not have a diagnostic partition packaged with your drive or you wish to remove it, these instructions do not vary much. Just be aware of those steps and skip them accordingly. In my case, the diagnostic partition is partition 1. So skipping should be easy. With all that said, lets begin the quest! = Installation = BIOS Boot -> UEFI Boot As mentioned previously, BIOS boot mode does not give an option for an alternate boot path if the primary drive goes south. Before we can boot the DVD and begin setup, we must change the boot mode to "UEFI". # Set Boot Mode to UEFI ## Press F2 (BIOS Setup) when visible in the top right corner during POST ## Navigate to "Boot Settings" ## Change Boot Mode from "BIOS" to "UEFI" ## Save and Exit # Set DVD-ROM as primary boot device ## Press F11 (UEFI Boot Manager) when visible in the top right corner during POST ## Navigate to "UEFI Boot Settings" ## Navigate to "UEFI Boot Sequence" ## Press Enter to enter "UEFI Boot Sequence" ## Use + to escalate DVD-ROM to the top of the list ## Save and Exit Mirror Primary Partitions to Secondary Drive Background Dell loads, on the installed drive, an MBR (DOS) partition table containing a diagnostic partition with a handful of utilities and an empty EFI boot partition. The layout of these partitions will cause an error during installation of BIOS boot mode because the offset of the first partition does not give enough room for GRUB's core.img to be installed on the disk when using RAID modules for the /boot partition. # fdisk -l /dev/sda Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0xd4e911ee Device Boot Start End Blocks Id System /dev/sda1 20 65579 32780 de Dell Utility /dev/sda2 * 67584 4261887 2097152 c W95 FAT32 (LBA) ____________________________________________________________________ # parted /dev/sda unit s print Model: ATA WDC WD5003ABYX-1 (scsi) Disk /dev/sda: 976773168s Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 20s 65579s 65560s primary fat16 diag 2 67584s 4261887s 4194304s primary fat32 boot, lba Generally, this core.img requires more than 30 sectors of space prior to the first partition. To solve this problem, we could continue using the MBR partition table and moving the partitions further out on the disk. Or, because we're using UEFI due to BIOS boot mode limitations not allowing alternate boot paths, we could go with GPT partition tables. With UEFI, we no longer need the core.img to load our GRUB boot loader. However, the partition table is still not optimal because it's starting at sector 20. This does not give very good partition alignment for performance. As most research into partition alignment will find, keeping partitions on a 1MB start, most block sizes will perform optimally performance-wise. Also of note is the size of the EFI partition (partition 2). This partition is sized by Dell at 2GB. By most accounts, this is way overkill. I decided to lower it to 128MB. Which is still overkill for an EFI partition. Setup Initial Partitions To achieve a proper GPT layout while still keeping the Dell diagnostic utilities, I utilize the second drive to build the initial partition table. # Boot the system from the DVD. # To perform the following with SSH ## Highlight "Install CentOS 7" ## Press Tab key to edit boot parameters ## On line starting with "linuxefi", add "sshd" to the end of the line. ## Press CTRL+X to boot ## To get a list of interfaces to use, run: ifconfig -a ## To add an IP address to connect to, run: ifconfig netmask up ## Perform the following within an SSH session # To perform the following without SSH ## Highlight "Install CentOS 7" ## Press Enter key ## Press CTRL+ALT+F2 to get a shell prompt